<?php
class ClassLink
{
	function insertData($linkid,$postid,$link)
	{
		$them="INSERT INTO `tblink` ( `linkid`,`postid`,`link` ) VALUES ($linkid,$postid,'$link');";
		$thucthi=mysql_query($them);
		return $thucthi;
	}
	function updateData($linkid,$postid,$link)
	{
		$update="UPDATE `tblink` SET `link` = '$link' WHERE `linkid` = $linkid and `postid`=$postid;";
		$thucthi=mysql_query($update);
		return $thucthi;
	}
	function delectData($linkid,$postid)
	{
		$delete="DELETE FROM tblink WHERE `postid` =$postid and linkid=$linkid";
		$thucthi=mysql_query($delete);
		return $thucthi;
	}
	function tableData($sql)
	{
		$row=$sql;
		$show=mysql_query($row);
		$table="<table>";
		while($result=mysql_fetch_array($show))
		{
			$table.="<tr>
						<td>".$result['linkid']."</td>
						<td>".$result['postid']."</td>
						<td>".$result['link']."</td>
					</tr>";
		}	
		$table.="</table>";
		return $table;
	}
}
?>